﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using XChip_Common;
using System.IO;
using XChipTool.Enties;

namespace XChipTool
{
    public partial class XChip_SecurityFile : DevExpress.XtraEditors.XtraForm
    {
        List<SettingFile> commonList = new List<SettingFile>();
        public delegate void SendEventBinSettingNewMsg(string msg);
        public event SendEventBinSettingNewMsg SendBinSetMsg;
        public bincurrencyManager Bincurrency_BLL;
        private bool bLoad = false;
        private string GuidNo;
        private int Id = -1;
        private bincurrency_export BinModel;
        private Dictionary<string, int> dicFrmat = new Dictionary<string, int>();
        public XChip_SecurityFile()
        {
            InitializeComponent();
        }
        public XChip_SecurityFile(bincurrency_export binmodel)
        {
            Id = binmodel.Id;
            GuidNo = binmodel.GuidId;
            BinModel = binmodel;
            InitializeComponent();
        }

        private void simpleButton3_Click(object sender, EventArgs e)
        {
            if (null != SendBinSetMsg)
            {
                SendBinSetMsg("");
            }
            DialogResult dr = DevExpress.XtraEditors.XtraMessageBox.Show($"选择YES保存后退出！ \r\n 选择NO直接退出！", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
            if (dr == DialogResult.No)
            {
                this.Close();
            }
            else
            {
                this.Close();
            }
        }

        private void SelectFolderButton_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();
            dialog.Description = "请选择文件路径";
            dialog.SelectedPath = AppHelper.GetAppConfig("Folder_Road_Force");
            ///Folder_Road_Force
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                //清空下拉框数据源
                ClearLookUpEditDataSource();
                string foldPath = dialog.SelectedPath;
                AppHelper.UpdateAppConfig("Folder_Road_Force", foldPath);
                ///*t*/extBox2.Text = foldPath;
                ///

                SetTipList();
            }
        }
        private void SetTipList()
        {
            var filePaths = Directory.GetFiles(AppHelper.GetAppConfig("Folder_Road_Force"), "*.txt").Concat(Directory.GetFiles(AppHelper.GetAppConfig("Folder_Road_Force"), "*.c")).ToArray();
            List<SettingFile> tlvList = new List<SettingFile>();
            foreach (var item in filePaths)
            {
                if (Path.GetFileName(item).Contains(" "))
                {
                    continue;
                }
                if (item.IndexOf(".bak", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    continue;
                }
                tlvList.Add(new SettingFile { FilePath = item, FileName = Path.GetFileName(item) });

            }
            var commonList = tlvList.Where(c => c.FileName.ToLower().Contains("xchip_common_setting")).ToList();
            if (commonList.Count() != 0)
            {
                commonTxt.Properties.DataSource = commonList;
                //commonTxt.ItemIndex = comList.Count() > 1 ? -1 : 0;//itemindex赋过正值后，无法赋成-1，原因未知
                //commonTxt.EditValue = null;
                commonTxt.EditValue = commonList.Count() > 1 ? string.Empty : commonList.First().FilePath;
                commonTxt.ItemIndex = 0;
            }
            //for (int i = 0; i < tlvList.Count; i++)
            //{
            //    var tag = int.Parse(SettingTo151_Help.SetTips151.Find(c => c.TransferName.ToLower() == tlvList[i].StandardName && c.VideoName.ToLower() == tlvList[i].TimingName).SettingNo);
            //    tlvList[i].Tag = tag;
            //}
            if (false)
            {
                //识别带制式的
                foreach (var item in tlvList)
                {
                    var tag = -1;
                    try
                    {
                        tag = int.Parse(SettingTo151_Help.SetTips151.Find(c => c.TransferName == item.StandardName && c.VideoName == item.TimingName).SettingNo) - 1;
                        var TransferName = SettingTo151_Help.SetTips151[tag].TransferName;
                        var VideoName = SettingTo151_Help.SetTips151[tag].VideoName;
                        if (tag != -1)
                        {
                            if (null != SettingTo151_Help.SetTips151[tag].data)
                            {
                                SettingTo151_Help.SetTips151[tag].data = new List<SettingFile>();
                                SettingTo151_Help.SetTips151[tag].data.AddRange(tlvList.Where(c => c.StandardName == TransferName && c.TimingName == VideoName).ToList());
                            }
                            else
                            {
                                SettingTo151_Help.SetTips151[tag].data = tlvList.Where(c => c.StandardName == TransferName && c.TimingName == VideoName).ToList();
                            }
                            if (!(null == SettingTo151_Help.SetTips151[tag].data || SettingTo151_Help.SetTips151[tag].data.Count() == 0))
                            {
                                SetSettingPath(tag + 1, SettingTo151_Help.SetTips151[tag].data);
                            }
                        }
                    }
                    catch (Exception)
                    {

                        continue;
                    }
                }
            }
            else
            {
                //识别X_[X]
                foreach (var item in tlvList.Where(c => c.Tag != -1))
                {
                    var tag = item.Tag;
                    if (null != SettingTo151_Help.SetTips151[tag].data)
                    {
                        SettingTo151_Help.SetTips151[tag].data = new List<SettingFile>();
                        SettingTo151_Help.SetTips151[tag].data.AddRange(tlvList.Where(c => c.Tag == tag).ToList());
                    }
                    else
                    {
                        SettingTo151_Help.SetTips151[tag].data = tlvList.Where(c => c.Tag == tag).ToList();
                    }
                    if (!(null == SettingTo151_Help.SetTips151[tag].data || SettingTo151_Help.SetTips151[tag].data.Count() == 0))
                    {
                        SetSettingPath(tag, SettingTo151_Help.SetTips151[tag].data);
                    }
                }
            }

            //for (int i = 0; i < SettingTo151_Help.SetTips151.Count; i++)
            //{
            //    if (i>=tlvList.Count()|| tlvList[i].Tag == -1)
            //    {
            //        continue;
            //    }
            //    if (null != SettingTo151_Help.SetTips151[i].data)
            //    {

            //    }
            //    else {

            //        SettingTo151_Help.SetTips151[tlvList[i].Tag].data = tlvList.Where(c => (c.Tag-1) == i).ToList();
            //    }
            //    if (!(null == SettingTo151_Help.SetTips151[tlvList[i].Tag].data || SettingTo151_Help.SetTips151[i].data.Count() == 0)) {
            //        SetSettingPath(i, SettingTo151_Help.SetTips151[i].data);
            //    }
            //}

        }
        private string SearchStr(string s1, string s2, string s3)
        {
            int n1, n2;                              //定义变量
            n1 = s1.IndexOf(s2, 0) + s2.Length;      //开始位置  
            n2 = s1.IndexOf(s3, n1);                 //结束位置  
            return s1.Substring(n1, n2 - n1);        //取搜索的条数，用结束的位置-开始的位置,并返回值
        }
        private void ClearLookUpEditDataSource()
        {
            //settingPathahd_1.Properties.DataSource = null; settingPathahd_1.EditValue = string.Empty;
            //settingPathahd_2.Properties.DataSource = null; settingPathahd_2.EditValue = string.Empty;
            //settingPathahd_3.Properties.DataSource = null; settingPathahd_3.EditValue = string.Empty;
            //settingPathahd_4.Properties.DataSource = null; settingPathahd_4.EditValue = string.Empty;
            //settingPathahd_5.Properties.DataSource = null; settingPathahd_5.EditValue = string.Empty;
            //settingPathahd_6.Properties.DataSource = null; settingPathahd_6.EditValue = string.Empty;
            //settingPathahd_7.Properties.DataSource = null; settingPathahd_7.EditValue = string.Empty;
            //settingPathahd_8.Properties.DataSource = null; settingPathahd_8.EditValue = string.Empty;
            //settingPathahd_9.Properties.DataSource = null; settingPathahd_9.EditValue = string.Empty;
            //settingPathahd_10.Properties.DataSource = null; settingPathahd_10.EditValue = string.Empty;
            //settingPathahd_11.Properties.DataSource = null; settingPathahd_11.EditValue = string.Empty;
            //settingPathahd_12.Properties.DataSource = null; settingPathahd_12.EditValue = string.Empty;

            //settingPathtvi_1.Properties.DataSource = null; settingPathtvi_1.EditValue = string.Empty;
            //settingPathtvi_2.Properties.DataSource = null; settingPathtvi_2.EditValue = string.Empty;
            //settingPathtvi_3.Properties.DataSource = null; settingPathtvi_3.EditValue = string.Empty;
            //settingPathtvi_4.Properties.DataSource = null; settingPathtvi_4.EditValue = string.Empty;
            //settingPathtvi_5.Properties.DataSource = null; settingPathtvi_5.EditValue = string.Empty;
            //settingPathtvi_6.Properties.DataSource = null; settingPathtvi_6.EditValue = string.Empty;
            //settingPathtvi_7.Properties.DataSource = null; settingPathtvi_7.EditValue = string.Empty;
            //settingPathtvi_8.Properties.DataSource = null; settingPathtvi_8.EditValue = string.Empty;
            //settingPathtvi_9.Properties.DataSource = null; settingPathtvi_9.EditValue = string.Empty;
            //settingPathtvi_10.Properties.DataSource = null; settingPathtvi_10.EditValue = string.Empty;
            //settingPathtvi_11.Properties.DataSource = null; settingPathtvi_11.EditValue = string.Empty;
            //settingPathtvi_12.Properties.DataSource = null; settingPathtvi_12.EditValue = string.Empty;

            //settingPathcvi_1.Properties.DataSource = null; settingPathcvi_1.EditValue = string.Empty;
            //settingPathcvi_2.Properties.DataSource = null; settingPathcvi_2.EditValue = string.Empty;
            //settingPathcvi_3.Properties.DataSource = null; settingPathcvi_3.EditValue = string.Empty;
            //settingPathcvi_4.Properties.DataSource = null; settingPathcvi_4.EditValue = string.Empty;
            //settingPathcvi_5.Properties.DataSource = null; settingPathcvi_5.EditValue = string.Empty;
            //settingPathcvi_6.Properties.DataSource = null; settingPathcvi_6.EditValue = string.Empty;
            //settingPathcvi_7.Properties.DataSource = null; settingPathcvi_7.EditValue = string.Empty;
            //settingPathcvi_8.Properties.DataSource = null; settingPathcvi_8.EditValue = string.Empty;
            //settingPathcvi_9.Properties.DataSource = null; settingPathcvi_9.EditValue = string.Empty;
            //settingPathcvi_10.Properties.DataSource = null; settingPathcvi_10.EditValue = string.Empty;
            //settingPathcvi_11.Properties.DataSource = null; settingPathcvi_11.EditValue = string.Empty;
            //settingPathcvi_12.Properties.DataSource = null; settingPathcvi_12.EditValue = string.Empty;

            //settingPathcvbs_1.Properties.DataSource = null; settingPathcvbs_1.EditValue = string.Empty;
            //settingPathcvbs_2.Properties.DataSource = null; settingPathcvbs_2.EditValue = string.Empty;
            //settingPathcvbs_3.Properties.DataSource = null; settingPathcvbs_3.EditValue = string.Empty;
            //settingPathcvbs_4.Properties.DataSource = null; settingPathcvbs_4.EditValue = string.Empty;
            //settingPathcvbs_5.Properties.DataSource = null; settingPathcvbs_5.EditValue = string.Empty;
            //settingPathcvbs_6.Properties.DataSource = null; settingPathcvbs_6.EditValue = string.Empty;
            //settingPathcvbs_7.Properties.DataSource = null; settingPathcvbs_7.EditValue = string.Empty;
            //settingPathcvbs_8.Properties.DataSource = null; settingPathcvbs_8.EditValue = string.Empty;
            //settingPathcvbs_9.Properties.DataSource = null; settingPathcvbs_9.EditValue = string.Empty;
            //settingPathcvbs_10.Properties.DataSource = null; settingPathcvbs_10.EditValue = string.Empty;
            //settingPathcvbs_11.Properties.DataSource = null; settingPathcvbs_11.EditValue = string.Empty;
            //settingPathcvbs_12.Properties.DataSource = null; settingPathcvbs_12.EditValue = string.Empty;
        }
        /// <summary>
        /// 拷贝文件 //生成批处理文本//生成批处理文件//执行批处理文件//生成完成
        /// </summary>
        /// <param name="Inputfilepath">文本路径</param>
        /// <param name="Isflash">是flash版本还eeprom版本</param>
        /// <param name="eepromaddr">eeprom值</param>
        /// <param name="isSetting">区分是setting栏还是其他栏</param>
        public string Copy_Files_For_Header_Patch_Tool(string Inputfilepath, bool Isflash, string eepromaddr, bool isSetting, bool isHead,uint setHex = 0x0)
        {
            string strFileName = System.IO.Path.GetFileName(Inputfilepath); //获取文件名
            string strNewSavePath = Application.StartupPath + "\\Lib\\xc151_setting\\Flash_"+setHex.ToString("X2") + strFileName;
            //判断该路径下文件是否存在
            if (File.Exists(strNewSavePath))
            {
                //如果存在文件就删除
                File.Delete(strNewSavePath);
            }
            if (isHead)
            {
                Setting2FlashE2prom.FlashHeader2Flash(Inputfilepath, strNewSavePath);
            }
            else
            {
                //Setting2FlashE2prom.FlashSetting2Flash(Inputfilepath, strNewSavePath, 1, 0, 0);
                Setting2FlashE2prom.FlashSetting2Flash(Inputfilepath, strNewSavePath, 0, 0, 0, 0, 0, setHex);
            }

            return strNewSavePath;
        }
        /// <summary>
        /// 根据文件路劲 获取文件长度
        /// </summary>
        /// <param name="mpath">16进制字符串</param>
        /// <returns></returns>
        public string FilePathLengthComplement(string mpath)
        {
            int tempLength = File.ReadAllLines(mpath).Length;
            var tempCount = Convert.ToUInt32((tempLength * 4).ToString("x4"), 16);

            return tempCount.ToString("X4");
        }
        private void RefreshView()
        {
            var modelPara = Bincurrency_BLL.GetList(c => c.GuidId == GuidNo && c.SerialNo == 0 &&
                (c.BinId == 6 || c.BinId == 7 || c.BinId == 8 || c.BinId == 9 || c.BinId == 2 || c.BinId == 3));
            var modelPara2 = Bincurrency_BLL.GetSingle(c => c.GuidId == GuidNo && c.SerialNo == 0 && c.BinId == 6);

            //setting0-3,至少要有一个文件，才算成功
            if (modelPara.Count > 0)
            {
                modelPara2.FileStatus = 2;
            }
            else
            {
                modelPara2.FileStatus = 0;
            }

            Bincurrency_BLL.Update(modelPara2);
        }

        private void XChip_SecurityFile_Load(object sender, EventArgs e)
        {
            if (null == Bincurrency_BLL) //初始化
            {
                Bincurrency_BLL = new bincurrencyManager();

            }
            ClearLookUpEditDataSource();
            //navigationPane1.SelectedPage = tviPage;
            //navigationPane1.SelectedPage = cviPage;
            //navigationPane1.SelectedPage = cvbsPage;
            //navigationPane1.SelectedPage = ahdPage;
            navigationPane1.SelectedPage = Setting3;
            navigationPane1.SelectedPage = Setting2;
            navigationPane1.SelectedPage = Setting1;
            navigationPane1.SelectedPage = Setting0;
            List<TreeListValue> listC = new List<TreeListValue>();



            for (int i = 0; i < 48; i++)
            {
                listC.Add(new TreeListValue { ValueMember = i.ToString("X2"), DisplayMember = i.ToString("X2") });
            }
            bianhaoLook.Properties.DataSource = listC;
            bianhaoLook.ItemIndex = 0;

            //增加提示
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 32; j++)
                {
                    try
                    {
                        Control col = this.Controls.Find($"txtlabSetting{i}_{j + 1}", true)[0];
                        if (!string.IsNullOrEmpty(SettingTo151_Help.SetTips151[i * 32 + j].Tips))
                        {
                            col.Text = SettingTo151_Help.SetTips151[i * 32 + j].Tips;
                        }
                        else
                        {
                            col.Text = $"Setting{i}_{j}";
                        }
                    }
                    catch (Exception ex)
                    {

                        throw;
                    }
                }
            }
          

            var list = Bincurrency_BLL.GetListToDefault(GuidNo);
            var model00 = list.Where(c => (c.BinId == 6 || c.BinId == 7 || c.BinId == 8 || c.BinId == 9) && c.BinInPath != null);
            foreach (var item in model00)
            {
                //var idex = SettingList_Help.SetTips128.FindIndex(c => c.SettingNo == item.SerialNo.ToString());
                SetSettingPath((int)item.SerialNo + 1, new List<SettingFile> { new SettingFile { FilePath = item.BinInPath, FileName = item.BinInName } });
            }
            var model99 = list.Find(c => (c.BinId == 7 &&  c.SerialNo == 48) && c.BinInPath != null);
            if (model99 != null)
            {
                //isloadAgain = true;
                //commonList = new List<TreeListValue>();
                //commonList.Add(new TreeListValue { ValueMember = model99.BinInPath, DisplayMember = model99.BinInName });
                commonTxt.Properties.DataSource = new List<SettingFile> { new SettingFile { FilePath = model99.BinInPath, FileName = model99.BinInName } };
                commonTxt.ItemIndex = 0;
                //isloadAgain = false;
            }

        }
        private void SetSettingPath(int num, List<SettingFile> data)
        {
            #region 带ahd的方法已注释
            //if (num == int.Parse(settingPathahd_1.Tag.ToString()))//ahd
            //{
            //    settingPathahd_1.Properties.DataSource = data; settingPathahd_1.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathahd_2.Tag.ToString()))
            //{
            //    settingPathahd_2.Properties.DataSource = data; settingPathahd_2.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathahd_3.Tag.ToString()))
            //{
            //    settingPathahd_3.Properties.DataSource = data; settingPathahd_3.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathahd_4.Tag.ToString()))
            //{
            //    settingPathahd_4.Properties.DataSource = data; settingPathahd_4.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathahd_5.Tag.ToString()))
            //{
            //    settingPathahd_5.Properties.DataSource = data; settingPathahd_5.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathahd_6.Tag.ToString()))
            //{
            //    settingPathahd_6.Properties.DataSource = data; settingPathahd_6.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathahd_7.Tag.ToString()))
            //{
            //    settingPathahd_7.Properties.DataSource = data; settingPathahd_7.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathahd_8.Tag.ToString()))
            //{
            //    settingPathahd_8.Properties.DataSource = data; settingPathahd_8.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathahd_9.Tag.ToString()))
            //{
            //    settingPathahd_9.Properties.DataSource = data; settingPathahd_9.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathahd_10.Tag.ToString()))
            //{
            //    settingPathahd_10.Properties.DataSource = data; settingPathahd_10.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathahd_11.Tag.ToString()))
            //{
            //    settingPathahd_11.Properties.DataSource = data; settingPathahd_11.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathahd_12.Tag.ToString()))
            //{
            //    settingPathahd_12.Properties.DataSource = data; settingPathahd_12.ItemIndex = 0;
            //}

            //else if (num == int.Parse(settingPathtvi_1.Tag.ToString())) //tvi
            //{
            //    settingPathtvi_1.Properties.DataSource = data; settingPathtvi_1.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathtvi_2.Tag.ToString()))
            //{
            //    settingPathtvi_2.Properties.DataSource = data; settingPathtvi_2.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathtvi_3.Tag.ToString()))
            //{
            //    settingPathtvi_3.Properties.DataSource = data; settingPathtvi_3.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathtvi_4.Tag.ToString()))
            //{
            //    settingPathtvi_4.Properties.DataSource = data; settingPathtvi_4.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathtvi_5.Tag.ToString()))
            //{
            //    settingPathtvi_5.Properties.DataSource = data; settingPathtvi_5.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathtvi_6.Tag.ToString()))
            //{
            //    settingPathtvi_6.Properties.DataSource = data; settingPathtvi_6.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathtvi_7.Tag.ToString()))
            //{
            //    settingPathtvi_7.Properties.DataSource = data; settingPathtvi_7.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathtvi_8.Tag.ToString()))
            //{
            //    settingPathtvi_8.Properties.DataSource = data; settingPathtvi_8.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathtvi_9.Tag.ToString()))
            //{
            //    settingPathtvi_9.Properties.DataSource = data; settingPathtvi_9.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathtvi_10.Tag.ToString()))
            //{
            //    settingPathtvi_10.Properties.DataSource = data; settingPathtvi_10.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathtvi_11.Tag.ToString()))
            //{
            //    settingPathtvi_11.Properties.DataSource = data; settingPathtvi_11.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathtvi_12.Tag.ToString()))
            //{
            //    settingPathtvi_12.Properties.DataSource = data; settingPathtvi_12.ItemIndex = 0;
            //}

            //else if (num == int.Parse(settingPathcvi_1.Tag.ToString()))//cvi
            //{
            //    settingPathcvi_1.Properties.DataSource = data; settingPathcvi_1.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvi_2.Tag.ToString()))
            //{
            //    settingPathcvi_2.Properties.DataSource = data; settingPathcvi_2.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvi_3.Tag.ToString()))
            //{
            //    settingPathcvi_3.Properties.DataSource = data; settingPathcvi_3.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvi_4.Tag.ToString()))
            //{
            //    settingPathcvi_4.Properties.DataSource = data; settingPathcvi_4.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvi_5.Tag.ToString()))
            //{
            //    settingPathcvi_5.Properties.DataSource = data; settingPathcvi_5.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvi_6.Tag.ToString()))
            //{
            //    settingPathcvi_6.Properties.DataSource = data; settingPathcvi_6.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvi_7.Tag.ToString()))
            //{
            //    settingPathcvi_7.Properties.DataSource = data; settingPathcvi_7.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvi_8.Tag.ToString()))
            //{
            //    settingPathcvi_8.Properties.DataSource = data; settingPathcvi_8.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvi_9.Tag.ToString()))
            //{
            //    settingPathcvi_9.Properties.DataSource = data; settingPathcvi_9.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvi_10.Tag.ToString()))
            //{
            //    settingPathcvi_10.Properties.DataSource = data; settingPathcvi_10.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvi_11.Tag.ToString()))
            //{
            //    settingPathcvi_11.Properties.DataSource = data; settingPathcvi_11.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvi_12.Tag.ToString()))
            //{
            //    settingPathcvi_12.Properties.DataSource = data; settingPathcvi_12.ItemIndex = 0;
            //}

            //else if (num == int.Parse(settingPathcvbs_1.Tag.ToString()))//cvbs
            //{
            //    settingPathcvbs_1.Properties.DataSource = data; settingPathcvbs_1.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvbs_2.Tag.ToString()))
            //{
            //    settingPathcvbs_2.Properties.DataSource = data; settingPathcvbs_2.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvbs_3.Tag.ToString()))
            //{
            //    settingPathcvbs_3.Properties.DataSource = data; settingPathcvbs_3.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvbs_4.Tag.ToString()))
            //{
            //    settingPathcvbs_4.Properties.DataSource = data; settingPathcvbs_4.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvbs_5.Tag.ToString()))
            //{
            //    settingPathcvbs_5.Properties.DataSource = data; settingPathcvbs_5.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvbs_6.Tag.ToString()))
            //{
            //    settingPathcvbs_6.Properties.DataSource = data; settingPathcvbs_6.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvbs_7.Tag.ToString()))
            //{
            //    settingPathcvbs_7.Properties.DataSource = data; settingPathcvbs_7.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvbs_8.Tag.ToString()))
            //{
            //    settingPathcvbs_8.Properties.DataSource = data; settingPathcvbs_8.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvbs_9.Tag.ToString()))
            //{
            //    settingPathcvbs_9.Properties.DataSource = data; settingPathcvbs_9.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvbs_10.Tag.ToString()))
            //{
            //    settingPathcvbs_10.Properties.DataSource = data; settingPathcvbs_10.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvbs_11.Tag.ToString()))
            //{
            //    settingPathcvbs_11.Properties.DataSource = data; settingPathcvbs_11.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathcvbs_12.Tag.ToString()))
            //{
            //    settingPathcvbs_12.Properties.DataSource = data; settingPathcvbs_12.ItemIndex = 0;
            //}
            ////setting2
            //else if (num == int.Parse(settingPathSetting2_1.Tag.ToString()))
            //{
            //    settingPathSetting2_1.Properties.DataSource = data; settingPathSetting2_1.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_2.Tag.ToString()))
            //{
            //    settingPathSetting2_2.Properties.DataSource = data; settingPathSetting2_2.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_3.Tag.ToString()))
            //{
            //    settingPathSetting2_3.Properties.DataSource = data; settingPathSetting2_3.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_4.Tag.ToString()))
            //{
            //    settingPathSetting2_4.Properties.DataSource = data; settingPathSetting2_4.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_5.Tag.ToString()))
            //{
            //    settingPathSetting2_5.Properties.DataSource = data; settingPathSetting2_5.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_6.Tag.ToString()))
            //{
            //    settingPathSetting2_6.Properties.DataSource = data; settingPathSetting2_6.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_7.Tag.ToString()))
            //{
            //    settingPathSetting2_7.Properties.DataSource = data; settingPathSetting2_7.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_8.Tag.ToString()))
            //{
            //    settingPathSetting2_8.Properties.DataSource = data; settingPathSetting2_8.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_9.Tag.ToString()))
            //{
            //    settingPathSetting2_9.Properties.DataSource = data; settingPathSetting2_9.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_10.Tag.ToString()))
            //{
            //    settingPathSetting2_10.Properties.DataSource = data; settingPathSetting2_10.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_11.Tag.ToString()))
            //{
            //    settingPathSetting2_11.Properties.DataSource = data; settingPathSetting2_11.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_12.Tag.ToString()))
            //{
            //    settingPathSetting2_12.Properties.DataSource = data; settingPathSetting2_12.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_13.Tag.ToString()))
            //{
            //    settingPathSetting2_13.Properties.DataSource = data; settingPathSetting2_13.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_14.Tag.ToString()))
            //{
            //    settingPathSetting2_14.Properties.DataSource = data; settingPathSetting2_14.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_15.Tag.ToString()))
            //{
            //    settingPathSetting2_15.Properties.DataSource = data; settingPathSetting2_15.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_16.Tag.ToString()))
            //{
            //    settingPathSetting2_16.Properties.DataSource = data; settingPathSetting2_16.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_17.Tag.ToString()))
            //{
            //    settingPathSetting2_17.Properties.DataSource = data; settingPathSetting2_17.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_18.Tag.ToString()))
            //{
            //    settingPathSetting2_18.Properties.DataSource = data; settingPathSetting2_18.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_19.Tag.ToString()))
            //{
            //    settingPathSetting2_19.Properties.DataSource = data; settingPathSetting2_19.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_20.Tag.ToString()))
            //{
            //    settingPathSetting2_20.Properties.DataSource = data; settingPathSetting2_20.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_21.Tag.ToString()))
            //{
            //    settingPathSetting2_21.Properties.DataSource = data; settingPathSetting2_21.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_22.Tag.ToString()))
            //{
            //    settingPathSetting2_22.Properties.DataSource = data; settingPathSetting2_22.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_23.Tag.ToString()))
            //{
            //    settingPathSetting2_23.Properties.DataSource = data; settingPathSetting2_23.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_24.Tag.ToString()))
            //{
            //    settingPathSetting2_24.Properties.DataSource = data; settingPathSetting2_24.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_25.Tag.ToString()))
            //{
            //    settingPathSetting2_25.Properties.DataSource = data; settingPathSetting2_25.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_26.Tag.ToString()))
            //{
            //    settingPathSetting2_26.Properties.DataSource = data; settingPathSetting2_26.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_27.Tag.ToString()))
            //{
            //    settingPathSetting2_27.Properties.DataSource = data; settingPathSetting2_27.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_28.Tag.ToString()))
            //{
            //    settingPathSetting2_28.Properties.DataSource = data; settingPathSetting2_28.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_29.Tag.ToString()))
            //{
            //    settingPathSetting2_29.Properties.DataSource = data; settingPathSetting2_29.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_30.Tag.ToString()))
            //{
            //    settingPathSetting2_30.Properties.DataSource = data; settingPathSetting2_30.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_31.Tag.ToString()))
            //{
            //    settingPathSetting2_31.Properties.DataSource = data; settingPathSetting2_31.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting2_32.Tag.ToString()))
            //{
            //    settingPathSetting2_32.Properties.DataSource = data; settingPathSetting2_32.ItemIndex = 0;
            //}
            ////setting3
            //else if (num == int.Parse(settingPathSetting3_1.Tag.ToString()))
            //{
            //    settingPathSetting3_1.Properties.DataSource = data; settingPathSetting3_1.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_2.Tag.ToString()))
            //{
            //    settingPathSetting3_2.Properties.DataSource = data; settingPathSetting3_2.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_3.Tag.ToString()))
            //{
            //    settingPathSetting3_3.Properties.DataSource = data; settingPathSetting3_3.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_4.Tag.ToString()))
            //{
            //    settingPathSetting3_4.Properties.DataSource = data; settingPathSetting3_4.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_5.Tag.ToString()))
            //{
            //    settingPathSetting3_5.Properties.DataSource = data; settingPathSetting3_5.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_6.Tag.ToString()))
            //{
            //    settingPathSetting3_6.Properties.DataSource = data; settingPathSetting3_6.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_7.Tag.ToString()))
            //{
            //    settingPathSetting3_7.Properties.DataSource = data; settingPathSetting3_7.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_8.Tag.ToString()))
            //{
            //    settingPathSetting3_8.Properties.DataSource = data; settingPathSetting3_8.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_9.Tag.ToString()))
            //{
            //    settingPathSetting3_9.Properties.DataSource = data; settingPathSetting3_9.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_10.Tag.ToString()))
            //{
            //    settingPathSetting3_10.Properties.DataSource = data; settingPathSetting3_10.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_11.Tag.ToString()))
            //{
            //    settingPathSetting3_11.Properties.DataSource = data; settingPathSetting3_11.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_12.Tag.ToString()))
            //{
            //    settingPathSetting3_12.Properties.DataSource = data; settingPathSetting3_12.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_13.Tag.ToString()))
            //{
            //    settingPathSetting3_13.Properties.DataSource = data; settingPathSetting3_13.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_14.Tag.ToString()))
            //{
            //    settingPathSetting3_14.Properties.DataSource = data; settingPathSetting3_14.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_15.Tag.ToString()))
            //{
            //    settingPathSetting3_15.Properties.DataSource = data; settingPathSetting3_15.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_16.Tag.ToString()))
            //{
            //    settingPathSetting3_16.Properties.DataSource = data; settingPathSetting3_16.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_17.Tag.ToString()))
            //{
            //    settingPathSetting3_17.Properties.DataSource = data; settingPathSetting3_17.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_18.Tag.ToString()))
            //{
            //    settingPathSetting3_18.Properties.DataSource = data; settingPathSetting3_18.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_19.Tag.ToString()))
            //{
            //    settingPathSetting3_19.Properties.DataSource = data; settingPathSetting3_19.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_20.Tag.ToString()))
            //{
            //    settingPathSetting3_20.Properties.DataSource = data; settingPathSetting3_20.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_21.Tag.ToString()))
            //{
            //    settingPathSetting3_21.Properties.DataSource = data; settingPathSetting3_21.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_22.Tag.ToString()))
            //{
            //    settingPathSetting3_22.Properties.DataSource = data; settingPathSetting3_22.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_23.Tag.ToString()))
            //{
            //    settingPathSetting3_23.Properties.DataSource = data; settingPathSetting3_23.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_24.Tag.ToString()))
            //{
            //    settingPathSetting3_24.Properties.DataSource = data; settingPathSetting3_24.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_25.Tag.ToString()))
            //{
            //    settingPathSetting3_25.Properties.DataSource = data; settingPathSetting3_25.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_26.Tag.ToString()))
            //{
            //    settingPathSetting3_26.Properties.DataSource = data; settingPathSetting3_26.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_27.Tag.ToString()))
            //{
            //    settingPathSetting3_27.Properties.DataSource = data; settingPathSetting3_27.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_28.Tag.ToString()))
            //{
            //    settingPathSetting3_28.Properties.DataSource = data; settingPathSetting3_28.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_29.Tag.ToString()))
            //{
            //    settingPathSetting3_29.Properties.DataSource = data; settingPathSetting3_29.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_30.Tag.ToString()))
            //{
            //    settingPathSetting3_30.Properties.DataSource = data; settingPathSetting3_30.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_31.Tag.ToString()))
            //{
            //    settingPathSetting3_31.Properties.DataSource = data; settingPathSetting3_31.ItemIndex = 0;
            //}
            //else if (num == int.Parse(settingPathSetting3_32.Tag.ToString()))
            //{
            //    settingPathSetting3_32.Properties.DataSource = data; settingPathSetting3_32.ItemIndex = 0;
            //}
            #endregion
            //Setting1
            if (num == int.Parse(settingPathSetting0_1.Tag.ToString()))
            {
                settingPathSetting0_1.Properties.DataSource = data; settingPathSetting0_1.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_2.Tag.ToString()))
            {
                settingPathSetting0_2.Properties.DataSource = data; settingPathSetting0_2.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_3.Tag.ToString()))
            {
                settingPathSetting0_3.Properties.DataSource = data; settingPathSetting0_3.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_4.Tag.ToString()))
            {
                settingPathSetting0_4.Properties.DataSource = data; settingPathSetting0_4.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_5.Tag.ToString()))
            {
                settingPathSetting0_5.Properties.DataSource = data; settingPathSetting0_5.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_6.Tag.ToString()))
            {
                settingPathSetting0_6.Properties.DataSource = data; settingPathSetting0_6.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_7.Tag.ToString()))
            {
                settingPathSetting0_7.Properties.DataSource = data; settingPathSetting0_7.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_8.Tag.ToString()))
            {
                settingPathSetting0_8.Properties.DataSource = data; settingPathSetting0_8.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_9.Tag.ToString()))
            {
                settingPathSetting0_9.Properties.DataSource = data; settingPathSetting0_9.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_10.Tag.ToString()))
            {
                settingPathSetting0_10.Properties.DataSource = data; settingPathSetting0_10.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_11.Tag.ToString()))
            {
                settingPathSetting0_11.Properties.DataSource = data; settingPathSetting0_11.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_12.Tag.ToString()))
            {
                settingPathSetting0_12.Properties.DataSource = data; settingPathSetting0_12.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_13.Tag.ToString()))
            {
                settingPathSetting0_13.Properties.DataSource = data; settingPathSetting0_13.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_14.Tag.ToString()))
            {
                settingPathSetting0_14.Properties.DataSource = data; settingPathSetting0_14.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_15.Tag.ToString()))
            {
                settingPathSetting0_15.Properties.DataSource = data; settingPathSetting0_15.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_16.Tag.ToString()))
            {
                settingPathSetting0_16.Properties.DataSource = data; settingPathSetting0_16.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_17.Tag.ToString()))
            {
                settingPathSetting0_17.Properties.DataSource = data; settingPathSetting0_17.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_18.Tag.ToString()))
            {
                settingPathSetting0_18.Properties.DataSource = data; settingPathSetting0_18.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_19.Tag.ToString()))
            {
                settingPathSetting0_19.Properties.DataSource = data; settingPathSetting0_19.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_20.Tag.ToString()))
            {
                settingPathSetting0_20.Properties.DataSource = data; settingPathSetting0_20.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_21.Tag.ToString()))
            {
                settingPathSetting0_21.Properties.DataSource = data; settingPathSetting0_21.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_22.Tag.ToString()))
            {
                settingPathSetting0_22.Properties.DataSource = data; settingPathSetting0_22.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_23.Tag.ToString()))
            {
                settingPathSetting0_23.Properties.DataSource = data; settingPathSetting0_23.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_24.Tag.ToString()))
            {
                settingPathSetting0_24.Properties.DataSource = data; settingPathSetting0_24.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_25.Tag.ToString()))
            {
                settingPathSetting0_25.Properties.DataSource = data; settingPathSetting0_25.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_26.Tag.ToString()))
            {
                settingPathSetting0_26.Properties.DataSource = data; settingPathSetting0_26.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_27.Tag.ToString()))
            {
                settingPathSetting0_27.Properties.DataSource = data; settingPathSetting0_27.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_28.Tag.ToString()))
            {
                settingPathSetting0_28.Properties.DataSource = data; settingPathSetting0_28.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_29.Tag.ToString()))
            {
                settingPathSetting0_29.Properties.DataSource = data; settingPathSetting0_29.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_30.Tag.ToString()))
            {
                settingPathSetting0_30.Properties.DataSource = data; settingPathSetting0_30.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_31.Tag.ToString()))
            {
                settingPathSetting0_31.Properties.DataSource = data; settingPathSetting0_31.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting0_32.Tag.ToString()))
            {
                settingPathSetting0_32.Properties.DataSource = data; settingPathSetting0_32.ItemIndex = 0;
            }
            //Setting1
            else if (num == int.Parse(settingPathSetting1_1.Tag.ToString()))
            {
                settingPathSetting1_1.Properties.DataSource = data; settingPathSetting1_1.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_2.Tag.ToString()))
            {
                settingPathSetting1_2.Properties.DataSource = data; settingPathSetting1_2.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_3.Tag.ToString()))
            {
                settingPathSetting1_3.Properties.DataSource = data; settingPathSetting1_3.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_4.Tag.ToString()))
            {
                settingPathSetting1_4.Properties.DataSource = data; settingPathSetting1_4.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_5.Tag.ToString()))
            {
                settingPathSetting1_5.Properties.DataSource = data; settingPathSetting1_5.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_6.Tag.ToString()))
            {
                settingPathSetting1_6.Properties.DataSource = data; settingPathSetting1_6.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_7.Tag.ToString()))
            {
                settingPathSetting1_7.Properties.DataSource = data; settingPathSetting1_7.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_8.Tag.ToString()))
            {
                settingPathSetting1_8.Properties.DataSource = data; settingPathSetting1_8.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_9.Tag.ToString()))
            {
                settingPathSetting1_9.Properties.DataSource = data; settingPathSetting1_9.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_10.Tag.ToString()))
            {
                settingPathSetting1_10.Properties.DataSource = data; settingPathSetting1_10.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_11.Tag.ToString()))
            {
                settingPathSetting1_11.Properties.DataSource = data; settingPathSetting1_11.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_12.Tag.ToString()))
            {
                settingPathSetting1_12.Properties.DataSource = data; settingPathSetting1_12.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_13.Tag.ToString()))
            {
                settingPathSetting1_13.Properties.DataSource = data; settingPathSetting1_13.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_14.Tag.ToString()))
            {
                settingPathSetting1_14.Properties.DataSource = data; settingPathSetting1_14.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_15.Tag.ToString()))
            {
                settingPathSetting1_15.Properties.DataSource = data; settingPathSetting1_15.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_16.Tag.ToString()))
            {
                settingPathSetting1_16.Properties.DataSource = data; settingPathSetting1_16.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_17.Tag.ToString()))
            {
                settingPathSetting1_17.Properties.DataSource = data; settingPathSetting1_17.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_18.Tag.ToString()))
            {
                settingPathSetting1_18.Properties.DataSource = data; settingPathSetting1_18.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_19.Tag.ToString()))
            {
                settingPathSetting1_19.Properties.DataSource = data; settingPathSetting1_19.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_20.Tag.ToString()))
            {
                settingPathSetting1_20.Properties.DataSource = data; settingPathSetting1_20.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_21.Tag.ToString()))
            {
                settingPathSetting1_21.Properties.DataSource = data; settingPathSetting1_21.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_22.Tag.ToString()))
            {
                settingPathSetting1_22.Properties.DataSource = data; settingPathSetting1_22.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_23.Tag.ToString()))
            {
                settingPathSetting1_23.Properties.DataSource = data; settingPathSetting1_23.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_24.Tag.ToString()))
            {
                settingPathSetting1_24.Properties.DataSource = data; settingPathSetting1_24.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_25.Tag.ToString()))
            {
                settingPathSetting1_25.Properties.DataSource = data; settingPathSetting1_25.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_26.Tag.ToString()))
            {
                settingPathSetting1_26.Properties.DataSource = data; settingPathSetting1_26.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_27.Tag.ToString()))
            {
                settingPathSetting1_27.Properties.DataSource = data; settingPathSetting1_27.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_28.Tag.ToString()))
            {
                settingPathSetting1_28.Properties.DataSource = data; settingPathSetting1_28.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_29.Tag.ToString()))
            {
                settingPathSetting1_29.Properties.DataSource = data; settingPathSetting1_29.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_30.Tag.ToString()))
            {
                settingPathSetting1_30.Properties.DataSource = data; settingPathSetting1_30.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_31.Tag.ToString()))
            {
                settingPathSetting1_31.Properties.DataSource = data; settingPathSetting1_31.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting1_32.Tag.ToString()))
            {
                settingPathSetting1_32.Properties.DataSource = data; settingPathSetting1_32.ItemIndex = 0;
            }
            //setting2
            else if (num == int.Parse(settingPathSetting2_1.Tag.ToString()))
            {
                settingPathSetting2_1.Properties.DataSource = data; settingPathSetting2_1.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_2.Tag.ToString()))
            {
                settingPathSetting2_2.Properties.DataSource = data; settingPathSetting2_2.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_3.Tag.ToString()))
            {
                settingPathSetting2_3.Properties.DataSource = data; settingPathSetting2_3.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_4.Tag.ToString()))
            {
                settingPathSetting2_4.Properties.DataSource = data; settingPathSetting2_4.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_5.Tag.ToString()))
            {
                settingPathSetting2_5.Properties.DataSource = data; settingPathSetting2_5.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_6.Tag.ToString()))
            {
                settingPathSetting2_6.Properties.DataSource = data; settingPathSetting2_6.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_7.Tag.ToString()))
            {
                settingPathSetting2_7.Properties.DataSource = data; settingPathSetting2_7.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_8.Tag.ToString()))
            {
                settingPathSetting2_8.Properties.DataSource = data; settingPathSetting2_8.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_9.Tag.ToString()))
            {
                settingPathSetting2_9.Properties.DataSource = data; settingPathSetting2_9.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_10.Tag.ToString()))
            {
                settingPathSetting2_10.Properties.DataSource = data; settingPathSetting2_10.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_11.Tag.ToString()))
            {
                settingPathSetting2_11.Properties.DataSource = data; settingPathSetting2_11.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_12.Tag.ToString()))
            {
                settingPathSetting2_12.Properties.DataSource = data; settingPathSetting2_12.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_13.Tag.ToString()))
            {
                settingPathSetting2_13.Properties.DataSource = data; settingPathSetting2_13.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_14.Tag.ToString()))
            {
                settingPathSetting2_14.Properties.DataSource = data; settingPathSetting2_14.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_15.Tag.ToString()))
            {
                settingPathSetting2_15.Properties.DataSource = data; settingPathSetting2_15.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_16.Tag.ToString()))
            {
                settingPathSetting2_16.Properties.DataSource = data; settingPathSetting2_16.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_17.Tag.ToString()))
            {
                settingPathSetting2_17.Properties.DataSource = data; settingPathSetting2_17.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_18.Tag.ToString()))
            {
                settingPathSetting2_18.Properties.DataSource = data; settingPathSetting2_18.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_19.Tag.ToString()))
            {
                settingPathSetting2_19.Properties.DataSource = data; settingPathSetting2_19.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_20.Tag.ToString()))
            {
                settingPathSetting2_20.Properties.DataSource = data; settingPathSetting2_20.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_21.Tag.ToString()))
            {
                settingPathSetting2_21.Properties.DataSource = data; settingPathSetting2_21.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_22.Tag.ToString()))
            {
                settingPathSetting2_22.Properties.DataSource = data; settingPathSetting2_22.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_23.Tag.ToString()))
            {
                settingPathSetting2_23.Properties.DataSource = data; settingPathSetting2_23.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_24.Tag.ToString()))
            {
                settingPathSetting2_24.Properties.DataSource = data; settingPathSetting2_24.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_25.Tag.ToString()))
            {
                settingPathSetting2_25.Properties.DataSource = data; settingPathSetting2_25.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_26.Tag.ToString()))
            {
                settingPathSetting2_26.Properties.DataSource = data; settingPathSetting2_26.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_27.Tag.ToString()))
            {
                settingPathSetting2_27.Properties.DataSource = data; settingPathSetting2_27.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_28.Tag.ToString()))
            {
                settingPathSetting2_28.Properties.DataSource = data; settingPathSetting2_28.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_29.Tag.ToString()))
            {
                settingPathSetting2_29.Properties.DataSource = data; settingPathSetting2_29.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_30.Tag.ToString()))
            {
                settingPathSetting2_30.Properties.DataSource = data; settingPathSetting2_30.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_31.Tag.ToString()))
            {
                settingPathSetting2_31.Properties.DataSource = data; settingPathSetting2_31.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting2_32.Tag.ToString()))
            {
                settingPathSetting2_32.Properties.DataSource = data; settingPathSetting2_32.ItemIndex = 0;
            }
            //setting3
            else if (num == int.Parse(settingPathSetting3_1.Tag.ToString()))
            {
                settingPathSetting3_1.Properties.DataSource = data; settingPathSetting3_1.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_2.Tag.ToString()))
            {
                settingPathSetting3_2.Properties.DataSource = data; settingPathSetting3_2.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_3.Tag.ToString()))
            {
                settingPathSetting3_3.Properties.DataSource = data; settingPathSetting3_3.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_4.Tag.ToString()))
            {
                settingPathSetting3_4.Properties.DataSource = data; settingPathSetting3_4.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_5.Tag.ToString()))
            {
                settingPathSetting3_5.Properties.DataSource = data; settingPathSetting3_5.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_6.Tag.ToString()))
            {
                settingPathSetting3_6.Properties.DataSource = data; settingPathSetting3_6.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_7.Tag.ToString()))
            {
                settingPathSetting3_7.Properties.DataSource = data; settingPathSetting3_7.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_8.Tag.ToString()))
            {
                settingPathSetting3_8.Properties.DataSource = data; settingPathSetting3_8.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_9.Tag.ToString()))
            {
                settingPathSetting3_9.Properties.DataSource = data; settingPathSetting3_9.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_10.Tag.ToString()))
            {
                settingPathSetting3_10.Properties.DataSource = data; settingPathSetting3_10.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_11.Tag.ToString()))
            {
                settingPathSetting3_11.Properties.DataSource = data; settingPathSetting3_11.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_12.Tag.ToString()))
            {
                settingPathSetting3_12.Properties.DataSource = data; settingPathSetting3_12.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_13.Tag.ToString()))
            {
                settingPathSetting3_13.Properties.DataSource = data; settingPathSetting3_13.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_14.Tag.ToString()))
            {
                settingPathSetting3_14.Properties.DataSource = data; settingPathSetting3_14.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_15.Tag.ToString()))
            {
                settingPathSetting3_15.Properties.DataSource = data; settingPathSetting3_15.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_16.Tag.ToString()))
            {
                settingPathSetting3_16.Properties.DataSource = data; settingPathSetting3_16.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_17.Tag.ToString()))
            {
                settingPathSetting3_17.Properties.DataSource = data; settingPathSetting3_17.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_18.Tag.ToString()))
            {
                settingPathSetting3_18.Properties.DataSource = data; settingPathSetting3_18.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_19.Tag.ToString()))
            {
                settingPathSetting3_19.Properties.DataSource = data; settingPathSetting3_19.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_20.Tag.ToString()))
            {
                settingPathSetting3_20.Properties.DataSource = data; settingPathSetting3_20.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_21.Tag.ToString()))
            {
                settingPathSetting3_21.Properties.DataSource = data; settingPathSetting3_21.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_22.Tag.ToString()))
            {
                settingPathSetting3_22.Properties.DataSource = data; settingPathSetting3_22.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_23.Tag.ToString()))
            {
                settingPathSetting3_23.Properties.DataSource = data; settingPathSetting3_23.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_24.Tag.ToString()))
            {
                settingPathSetting3_24.Properties.DataSource = data; settingPathSetting3_24.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_25.Tag.ToString()))
            {
                settingPathSetting3_25.Properties.DataSource = data; settingPathSetting3_25.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_26.Tag.ToString()))
            {
                settingPathSetting3_26.Properties.DataSource = data; settingPathSetting3_26.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_27.Tag.ToString()))
            {
                settingPathSetting3_27.Properties.DataSource = data; settingPathSetting3_27.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_28.Tag.ToString()))
            {
                settingPathSetting3_28.Properties.DataSource = data; settingPathSetting3_28.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_29.Tag.ToString()))
            {
                settingPathSetting3_29.Properties.DataSource = data; settingPathSetting3_29.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_30.Tag.ToString()))
            {
                settingPathSetting3_30.Properties.DataSource = data; settingPathSetting3_30.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_31.Tag.ToString()))
            {
                settingPathSetting3_31.Properties.DataSource = data; settingPathSetting3_31.ItemIndex = 0;
            }
            else if (num == int.Parse(settingPathSetting3_32.Tag.ToString()))
            {
                settingPathSetting3_32.Properties.DataSource = data; settingPathSetting3_32.ItemIndex = 0;
            }
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (null != SendBinSetMsg)
            {
                SendBinSetMsg("");
            }
            this.Close();

        }

        private void bianhaoLook_EditValueChanged(object sender, EventArgs e)
        {
            var model99 = Bincurrency_BLL.GetList(c => c.GuidId == GuidNo);
            if (!model99.Exists(c => c.BinId == 11 && c.SerialNo == 0 && c.GuidId == GuidNo)) //binid 
            {
                var mode102 = new bincurrency();
                mode102.GuidId = GuidNo;
                mode102.BinId = 11;
                mode102.LengthAddress = "1000";
                mode102.BinInName = $"{bianhaoLook.EditValue.ToString()}.txt";
                mode102.BinInPath = $"{Application.StartupPath}\\Lib\\XChip_Bin\\{bianhaoLook.EditValue.ToString()}.txt";
                mode102.BinOutName = $"{bianhaoLook.EditValue.ToString()}.txt";
                mode102.BinOutPath = $"{Application.StartupPath}\\Lib\\XChip_Bin\\{bianhaoLook.EditValue.ToString()}.txt";
                mode102.BinAddressNo = bianhaoLook.EditValue.ToString();
                mode102.BinAddressOutName = $"{Application.StartupPath}\\Lib\\XChip_Bin\\{bianhaoLook.EditValue.ToString()}.txt";
                mode102.SortOrder = 0;
                mode102.SerialNo = 0;
                mode102.IsModified = 0;
                Bincurrency_BLL.Insert(mode102);
            }
            else
            {
                //更新
                var model = model99.First(c => c.BinId == 11 && c.SerialNo == 0 && c.GuidId == GuidNo);
                model.BinAddressNo = bianhaoLook.EditValue.ToString();
                model.BinAddressOutName = $"{Application.StartupPath}\\Lib\\{bianhaoLook.EditValue.ToString()}.txt";
                Bincurrency_BLL.Update(model);
            }
        }

        private void simpleButton2_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        private void settingPathahd_1_EditValueChanged(object sender, EventArgs e)
        {
            var settingPath = sender as LookUpEdit;
            BinUpdate(settingPath.Text.ToString(), settingPath.Tag.ToString());
        }

        private void BinUpdate(string pathName, string tag)
        {
            if (string.IsNullOrEmpty(pathName) || pathName == "请选择文件") return;
           
            var list = Bincurrency_BLL.GetList(c => c.GuidId == BinModel.GuidId && (c.BinId == 6 || c.BinId == 7 || c.BinId == 8 || c.BinId == 9) && c.SerialNo != 48);
            //var list = Bincurrency_BLL.GetList(c => c.GuidId == BinModel.GuidId && (c.BinId == 6 || c.BinId == 7 || c.BinId == 8 || c.BinId == 9));
            var modelMax = list.Max(c => c.SortOrder) == null ? 0 : list.Max(c => c.SortOrder);
            var tagTemp = (int.Parse(tag) - 1);
            var modelT = SettingTo151_Help.SetTips151[tagTemp];
            uint settingHex = 0;
            if (string.IsNullOrEmpty(modelT.TransferHex) || string.IsNullOrEmpty(modelT.VideoHex))
            {
                settingHex = Convert.ToUInt32($"{tagTemp.ToString("X2")}000000", 16);
            }
            else {
                settingHex = Convert.ToUInt32($"{tagTemp.ToString("X2")}00{modelT.TransferHex.Replace("0x", "")}{modelT.VideoHex.Replace("0x", "")}", 16);
            }
            //// 处理文件名称 相同文件 根据Tag值进行区分 用与Flash生成需要添加不同的内容
            //string FileName = System.IO.Path.GetFileName(pathName); //获取文件名
            //string saveName = System.IO.Path.GetDirectoryName(pathName);
            if (!list.Exists(c => c.SerialNo == tagTemp))
            {
                bincurrency model = new bincurrency();
                model.GuidId = GuidNo;
                model.BinId = (tagTemp / 32) + 6;
                model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                model.BinInPath = pathName;
                model.BinInName = Path.GetFileName(pathName);
                var pathNameout = Copy_Files_For_Header_Patch_Tool(pathName, true, "", true, false, settingHex);
                model.BinOutName = Path.GetFileName(pathNameout);
                model.BinOutPath = pathNameout;
                model.FileStatus = 2;
                model.SerialNo = tagTemp;
                //model.SortOrder = modelMax + 1;
                model.SortOrder = tagTemp;
                model.IsModified = 0;
                model.LengthAddress = HeaderHelper.FilePathLengthComplementnew(model.BinOutPath);
                Bincurrency_BLL.Insert(model);
            }
            else
            {
                var model = list.Find(c => c.SerialNo == tagTemp);
                model.BinInPath = pathName;
                model.BinInName = Path.GetFileName(pathName);
                var pathNameout = Copy_Files_For_Header_Patch_Tool(pathName, true, "", true, false, settingHex);
                model.BinOutName = Path.GetFileName(pathNameout);
                model.BinOutPath = pathNameout;
                model.SerialNo = tagTemp;
                model.FileStatus = 2;
                model.LengthAddress = HeaderHelper.FilePathLengthComplementnew(model.BinOutPath);
                Bincurrency_BLL.Update(model);
            }
            var mode = list.Find(c => c.IsModified == 1);
            mode.FileStatus = 2;
            Bincurrency_BLL.Update(mode);
        }

        private void settingPathtvi_1_EditValueChanged(object sender, EventArgs e)
        {
            var settingPath = sender as LookUpEdit;
            BinUpdate(settingPath.Text.ToString(), settingPath.Tag.ToString());
        }

        private void settingPathcvi_1_EditValueChanged(object sender, EventArgs e)
        {
            var settingPath = sender as LookUpEdit;
            BinUpdate(settingPath.Text.ToString(), settingPath.Tag.ToString());
        }

        private void settingPathcvbs_1_EditValueChanged(object sender, EventArgs e)
        {
            var settingPath = sender as LookUpEdit;
            BinUpdate(settingPath.Text.ToString(), settingPath.Tag.ToString());
        }

        private void setbtnahd_1_Click(object sender, EventArgs e)
        {
            var btn = sender as DevExpress.XtraEditors.SimpleButton;
            try
            {
                var serialno = (int.Parse(btn.Tag.ToString()) - 1);
                OpenFileDialog openFileDialog1 = new OpenFileDialog();
                openFileDialog1.Filter = "TXT Files(*.txt;*.c)|*.txt;*.c|All Files(*.*)|*.*";
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    #region 32套文件勾选
                    //switch (btn.Tag.ToString())
                    //{
                    //    case "1":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathahd_1);
                    //        }
                    //        break;
                    //    case "2":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathahd_2);
                    //        }
                    //        break;
                    //    case "3":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathahd_3);
                    //        }
                    //        break;
                    //    case "4":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathahd_4);
                    //        }
                    //        break;
                    //    case "5":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathahd_5);
                    //        }
                    //        break;
                    //    case "6":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathahd_6);
                    //        }
                    //        break;
                    //    case "7":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathahd_7);
                    //        }
                    //        break;
                    //    case "8":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathahd_8);
                    //        }
                    //        break;
                    //    case "9":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathahd_9);
                    //        }
                    //        break;
                    //    case "10":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathahd_10);
                    //        }
                    //        break;
                    //    case "11":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathahd_11);
                    //        }
                    //        break;
                    //    case "12":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathahd_12);
                    //        }
                    //        break;
                    //    case "13":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathtvi_1);
                    //        }
                    //        break;
                    //    case "14":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathtvi_2);
                    //        }
                    //        break;
                    //    case "15":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathtvi_3);
                    //        }
                    //        break;
                    //    case "16":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathtvi_4);
                    //        }
                    //        break;
                    //    case "17":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathtvi_5);
                    //        }
                    //        break;
                    //    case "18":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathtvi_6);
                    //        }
                    //        break;
                    //    case "19":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathtvi_7);
                    //        }
                    //        break;
                    //    case "20":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathtvi_8);
                    //        }
                    //        break;
                    //    case "21":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathtvi_9);
                    //        }
                    //        break;
                    //    case "22":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathtvi_10);
                    //        }
                    //        break;
                    //    case "23":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathtvi_11);
                    //        }
                    //        break;
                    //    case "24":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathtvi_12);
                    //        }
                    //        break;
                    //    case "25":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvi_1);
                    //        }
                    //        break;
                    //    case "26":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvi_2);
                    //        }
                    //        break;
                    //    case "27":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvi_3);
                    //        }
                    //        break;
                    //    case "28":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvi_4);
                    //        }
                    //        break;
                    //    case "29":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvi_5);
                    //        }
                    //        break;
                    //    case "30":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvi_6);
                    //        }
                    //        break;
                    //    case "31":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvi_7);
                    //        }
                    //        break;
                    //    case "32":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvi_8);
                    //        }
                    //        break;
                    //    case "33":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvi_9);
                    //        }
                    //        break;
                    //    case "34":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvi_10);
                    //        }
                    //        break;
                    //    case "35":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvi_11);
                    //        }
                    //        break;
                    //    case "36":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvi_12);
                    //        }
                    //        break;
                    //    case "37":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvbs_1);
                    //        }
                    //        break;
                    //    case "38":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvbs_2);
                    //        }
                    //        break;
                    //    case "39":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvbs_3);
                    //        }
                    //        break;
                    //    case "40":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvbs_4);
                    //        }
                    //        break;
                    //    case "41":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvbs_5);
                    //        }
                    //        break;
                    //    case "42":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvbs_6);
                    //        }
                    //        break;
                    //    case "43":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvbs_7);
                    //        }
                    //        break;
                    //    case "44":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvbs_8);
                    //        }
                    //        break;
                    //    case "45":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvbs_9);
                    //        }
                    //        break;
                    //    case "46":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvbs_10);
                    //        }
                    //        break;
                    //    case "47":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvbs_11);
                    //        }
                    //        break;
                    //    case "48":
                    //        {
                    //            SetLookEdit(openFileDialog1, serialno, settingPathcvbs_12);
                    //        }
                    //        break;
                    //    default:
                    //        break;
                    //}
                    #endregion
                }
            }
            catch
            {
                WaitBefore.Close();
                //WaitBeforeLogin.Invoke((EventHandler)delegate { WaitBeforeLogin.Close(); });
                GenerateFileHelp.Close_Process_ByAll();
            }
        }
        private static void SetLookEdit(OpenFileDialog openFileDialog1, int Num, DevExpress.XtraEditors.LookUpEdit setPath)
        {
            if (null == SettingTo151_Help.SetTips151[Num].data)
            {
                SettingTo151_Help.SetTips151[Num].data = new List<SettingFile>();
            }
            //SettingList_Help.SetTips32[Num].Tag = Num.ToString();
            SettingTo151_Help.SetTips151[Num].data.Add(new SettingFile() { FilePath = openFileDialog1.FileName, FileName = Path.GetFileName(openFileDialog1.FileName) });
            setPath.Properties.DataSource = SettingTo151_Help.SetTips151[Num].data;
            setPath.ItemIndex = SettingTo151_Help.SetTips151[Num].data.Count() - 1;
            //ParaHelp.Bin_Taoshi_Utc.Find(c => c.Note == SettingList_Help.SetTips32[Num].Tips).PValue = $"0x{Convert.ToInt32(SettingList_Help.SetTips32[Num].SettingNo).ToString("X2").PadLeft(2, '0')}";

        }
        private void commonTxt_EditValueChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(commonTxt.Text) && commonTxt.Text != "请选择文件")
            {
                //id 117  IsModified =1;
                var model99 = Bincurrency_BLL.GetSingle(c => c.GuidId == GuidNo && c.SerialNo == 48 && c.BinId == 7);
                var list = Bincurrency_BLL.GetList(c => c.GuidId == BinModel.GuidId && (c.BinId == 6 || c.BinId == 7 || c.BinId == 8 || c.BinId == 9));
                var modelMax = list.Max(c => c.SortOrder) == null ? 0 : list.Max(c => c.SortOrder);
                if (null == model99)
                {
                    var mode102 = new bincurrency();
                    mode102.GuidId = GuidNo;
                    mode102.BinId = 7;
                    mode102.CreateTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                    mode102.BinInPath = commonTxt.Text.ToString();
                    mode102.BinInName = Path.GetFileName(commonTxt.Text.ToString());
                    var pathNameout = Copy_Files_For_Header_Patch_Tool(commonTxt.Text.ToString(), true, "", true, false);
                    mode102.BinOutName = Path.GetFileName(pathNameout);
                    mode102.BinOutPath = pathNameout;
                    mode102.SerialNo = 48;
                    mode102.SortOrder = 48;
                    mode102.IsModified = 0;
                    mode102.LengthAddress = HeaderHelper.FilePathLengthComplementnew(mode102.BinOutPath);
                    Bincurrency_BLL.Insert(mode102);
                }
                else
                {
                    model99.BinInPath = commonTxt.Text.ToString();
                    model99.BinInName = Path.GetFileName(commonTxt.Text.ToString());
                    var pathNameout = Copy_Files_For_Header_Patch_Tool(commonTxt.Text.ToString(), true, "", true, false);
                    model99.BinOutName = Path.GetFileName(pathNameout);
                    model99.BinOutPath = pathNameout;
                    model99.LengthAddress = HeaderHelper.FilePathLengthComplementnew(model99.BinOutPath);
                    model99.CreateTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                    Bincurrency_BLL.Update(model99);
                }

            }
        }

        private void settingPathSetting2_1_EditValueChanged(object sender, EventArgs e)
        {
            var settingPath = sender as LookUpEdit;
            BinUpdate(settingPath.Text.ToString(), settingPath.Tag.ToString());
        }

        private void settingPathSetting3_1_EditValueChanged(object sender, EventArgs e)
        {
            var settingPath = sender as LookUpEdit;
            BinUpdate(settingPath.Text.ToString(), settingPath.Tag.ToString());
        }

        private void setbtnsetting2_1_Click(object sender, EventArgs e)
        {
            var btn = sender as DevExpress.XtraEditors.SimpleButton;
            try
            {
                var serialno = (int.Parse(btn.Tag.ToString()) - 1);
                OpenFileDialog openFileDialog1 = new OpenFileDialog();
                openFileDialog1.Filter = "TXT Files(*.txt;*.c)|*.txt;*.c|All Files(*.*)|*.*";
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    DirectoryInfo parentDirectory = Directory.GetParent(openFileDialog1.FileName);
                    string foldPath = parentDirectory.FullName;
                    AppHelper.UpdateAppConfig("Folder_Road_Force", foldPath);
                    #region 32套文件勾选
                    switch (btn.Tag.ToString())
                    {
                        case "1":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_1);
                            }
                            break;
                        case "2":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_2);
                            }
                            break;
                        case "3":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_3);
                            }
                            break;
                        case "4":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_4);
                            }
                            break;
                        case "5":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_5);
                            }
                            break;
                        case "6":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_6);
                            }
                            break;
                        case "7":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_7);
                            }
                            break;
                        case "8":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_8);
                            }
                            break;
                        case "9":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_9);
                            }
                            break;
                        case "10":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_10);
                            }
                            break;
                        case "11":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_11);
                            }
                            break;
                        case "12":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_12);
                            }
                            break;
                        case "13":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_13);
                            }
                            break;
                        case "14":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_14);
                            }
                            break;
                        case "15":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_15);
                            }
                            break;
                        case "16":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_16);
                            }
                            break;
                        case "17":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_17);
                            }
                            break;
                        case "18":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_18);
                            }
                            break;
                        case "19":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_19);
                            }
                            break;
                        case "20":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_20);
                            }
                            break;
                        case "21":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_21);
                            }
                            break;
                        case "22":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_22);
                            }
                            break;
                        case "23":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_23);
                            }
                            break;
                        case "24":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_24);
                            }
                            break;
                        case "25":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_25);
                            }
                            break;
                        case "26":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_26);
                            }
                            break;
                        case "27":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_27);
                            }
                            break;
                        case "28":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_28);
                            }
                            break;
                        case "29":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_29);
                            }
                            break;
                        case "30":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_30);
                            }
                            break;
                        case "31":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_31);
                            }
                            break;
                        case "32":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting2_32);
                            }
                            break;
                        default:
                            break;
                    }
                    #endregion
                }
            }
            catch
            {
                WaitBefore.Close();
                //WaitBeforeLogin.Invoke((EventHandler)delegate { WaitBeforeLogin.Close(); });
                GenerateFileHelp.Close_Process_ByAll();
            }
        }

        private void setbtnsetting3_1_Click(object sender, EventArgs e)
        {
            var btn = sender as DevExpress.XtraEditors.SimpleButton;
            try
            {
                var serialno = (int.Parse(btn.Tag.ToString()) - 1);
                OpenFileDialog openFileDialog1 = new OpenFileDialog();
                openFileDialog1.Filter = "TXT Files(*.txt;*.c)|*.txt;*.c|All Files(*.*)|*.*";
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    DirectoryInfo parentDirectory = Directory.GetParent(openFileDialog1.FileName);
                    string foldPath = parentDirectory.FullName;
                    AppHelper.UpdateAppConfig("Folder_Road_Force", foldPath);
                    #region 32套文件勾选
                    switch (btn.Tag.ToString())
                    {
                        case "1":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_1);
                            }
                            break;
                        case "2":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_2);
                            }
                            break;
                        case "3":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_3);
                            }
                            break;
                        case "4":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_4);
                            }
                            break;
                        case "5":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_5);
                            }
                            break;
                        case "6":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_6);
                            }
                            break;
                        case "7":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_7);
                            }
                            break;
                        case "8":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_8);
                            }
                            break;
                        case "9":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_9);
                            }
                            break;
                        case "10":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_10);
                            }
                            break;
                        case "11":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_11);
                            }
                            break;
                        case "12":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_12);
                            }
                            break;
                        case "13":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_13);
                            }
                            break;
                        case "14":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_14);
                            }
                            break;
                        case "15":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_15);
                            }
                            break;
                        case "16":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_16);
                            }
                            break;
                        case "17":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_17);
                            }
                            break;
                        case "18":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_18);
                            }
                            break;
                        case "19":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_19);
                            }
                            break;
                        case "20":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_20);
                            }
                            break;
                        case "21":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_21);
                            }
                            break;
                        case "22":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_22);
                            }
                            break;
                        case "23":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_23);
                            }
                            break;
                        case "24":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_24);
                            }
                            break;
                        case "25":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_25);
                            }
                            break;
                        case "26":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_26);
                            }
                            break;
                        case "27":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_27);
                            }
                            break;
                        case "28":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_28);
                            }
                            break;
                        case "29":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_29);
                            }
                            break;
                        case "30":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_30);
                            }
                            break;
                        case "31":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_31);
                            }
                            break;
                        case "32":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting3_32);
                            }
                            break;
                        default:
                            break;
                    }
                    #endregion
                }
            }
            catch
            {
                WaitBefore.Close();
                //WaitBeforeLogin.Invoke((EventHandler)delegate { WaitBeforeLogin.Close(); });
                GenerateFileHelp.Close_Process_ByAll();
            }
        }

        private void settingPathSetting0_1_EditValueChanged(object sender, EventArgs e)
        {
            var settingPath = sender as LookUpEdit;
            BinUpdate(settingPath.Text.ToString(), settingPath.Tag.ToString());
        }

        private void settingPathSetting1_1_EditValueChanged(object sender, EventArgs e)
        {
            var settingPath = sender as LookUpEdit;
            BinUpdate(settingPath.Text.ToString(), settingPath.Tag.ToString());
        }

        private void setbtnsetting0_1_Click(object sender, EventArgs e)
        {
            var btn = sender as DevExpress.XtraEditors.SimpleButton;
            try
            {
                var serialno = (int.Parse(btn.Tag.ToString()) - 1);
                OpenFileDialog openFileDialog1 = new OpenFileDialog();
                openFileDialog1.Filter = "TXT Files(*.txt;*.c)|*.txt;*.c|All Files(*.*)|*.*";
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    DirectoryInfo parentDirectory = Directory.GetParent(openFileDialog1.FileName);
                    string foldPath = parentDirectory.FullName;
                    AppHelper.UpdateAppConfig("Folder_Road_Force", foldPath);
                    #region 32套文件勾选
                    switch (btn.Tag.ToString())
                    {
                        case "1":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_1);
                            }
                            break;
                        case "2":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_2);
                            }
                            break;
                        case "3":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_3);
                            }
                            break;
                        case "4":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_4);
                            }
                            break;
                        case "5":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_5);
                            }
                            break;
                        case "6":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_6);
                            }
                            break;
                        case "7":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_7);
                            }
                            break;
                        case "8":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_8);
                            }
                            break;
                        case "9":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_9);
                            }
                            break;
                        case "10":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_10);
                            }
                            break;
                        case "11":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_11);
                            }
                            break;
                        case "12":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_12);
                            }
                            break;
                        case "13":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_13);
                            }
                            break;
                        case "14":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_14);
                            }
                            break;
                        case "15":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_15);
                            }
                            break;
                        case "16":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_16);
                            }
                            break;
                        case "17":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_17);
                            }
                            break;
                        case "18":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_18);
                            }
                            break;
                        case "19":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_19);
                            }
                            break;
                        case "20":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_20);
                            }
                            break;
                        case "21":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_21);
                            }
                            break;
                        case "22":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_22);
                            }
                            break;
                        case "23":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_23);
                            }
                            break;
                        case "24":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_24);
                            }
                            break;
                        case "25":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_25);
                            }
                            break;
                        case "26":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_26);
                            }
                            break;
                        case "27":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_27);
                            }
                            break;
                        case "28":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_28);
                            }
                            break;
                        case "29":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_29);
                            }
                            break;
                        case "30":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_30);
                            }
                            break;
                        case "31":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_31);
                            }
                            break;
                        case "32":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting0_32);
                            }
                            break;
                        default:
                            break;
                    }
                    #endregion
                }
            }
            catch
            {
                WaitBefore.Close();
                //WaitBeforeLogin.Invoke((EventHandler)delegate { WaitBeforeLogin.Close(); });
                GenerateFileHelp.Close_Process_ByAll();
            }
        }

        private void setbtnsetting1_1_Click(object sender, EventArgs e)
        {
            var btn = sender as DevExpress.XtraEditors.SimpleButton;
            try
            {
                var serialno = (int.Parse(btn.Tag.ToString()) - 1);
                OpenFileDialog openFileDialog1 = new OpenFileDialog();
                openFileDialog1.Filter = "TXT Files(*.txt;*.c)|*.txt;*.c|All Files(*.*)|*.*";
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    DirectoryInfo parentDirectory = Directory.GetParent(openFileDialog1.FileName);
                    string foldPath = parentDirectory.FullName;
                    AppHelper.UpdateAppConfig("Folder_Road_Force", foldPath);
                    #region 32套文件勾选
                    switch (btn.Tag.ToString())
                    {
                        case "1":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_1);
                            }
                            break;
                        case "2":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_2);
                            }
                            break;
                        case "3":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_3);
                            }
                            break;
                        case "4":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_4);
                            }
                            break;
                        case "5":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_5);
                            }
                            break;
                        case "6":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_6);
                            }
                            break;
                        case "7":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_7);
                            }
                            break;
                        case "8":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_8);
                            }
                            break;
                        case "9":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_9);
                            }
                            break;
                        case "10":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_10);
                            }
                            break;
                        case "11":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_11);
                            }
                            break;
                        case "12":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_12);
                            }
                            break;
                        case "13":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_13);
                            }
                            break;
                        case "14":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_14);
                            }
                            break;
                        case "15":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_15);
                            }
                            break;
                        case "16":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_16);
                            }
                            break;
                        case "17":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_17);
                            }
                            break;
                        case "18":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_18);
                            }
                            break;
                        case "19":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_19);
                            }
                            break;
                        case "20":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_20);
                            }
                            break;
                        case "21":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_21);
                            }
                            break;
                        case "22":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_22);
                            }
                            break;
                        case "23":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_23);
                            }
                            break;
                        case "24":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_24);
                            }
                            break;
                        case "25":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_25);
                            }
                            break;
                        case "26":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_26);
                            }
                            break;
                        case "27":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_27);
                            }
                            break;
                        case "28":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_28);
                            }
                            break;
                        case "29":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_29);
                            }
                            break;
                        case "30":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_30);
                            }
                            break;
                        case "31":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_31);
                            }
                            break;
                        case "32":
                            {
                                SetLookEdit(openFileDialog1, serialno, settingPathSetting1_32);
                            }
                            break;
                        default:
                            break;
                    }
                    #endregion
                }
            }
            catch
            {
                WaitBefore.Close();
                //WaitBeforeLogin.Invoke((EventHandler)delegate { WaitBeforeLogin.Close(); });
                GenerateFileHelp.Close_Process_ByAll();
            }
        }

        private void simpleButton194_Click(object sender, EventArgs e)
        {

        }
    }
}